package View;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.SwingConstants;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;

import java.awt.event.ActionListener;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.awt.event.ActionEvent;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;

import javax.swing.BorderFactory;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.border.LineBorder;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;

import ORM.ItemGoods;
import ORM.vipInformation;
import global.DiscountGlobal;

import javax.swing.event.CaretListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.CaretEvent;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;

public class System_staff extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTable table;
	private JTextField textField_3;
	private JTextField textField_4;
	private JTextField textField_5;

	/**
	 * Launch the application.
	 */
	
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					System_staff frame = new System_staff();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	@SuppressWarnings("deprecation")
	public System_staff() {
		setTitle("收银系统");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 1478, 822);
		contentPane = new JPanel();
		contentPane.setBackground(new Color(255, 255, 255));
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new BorderLayout(0, 0));
		
		JPanel panel = new JPanel();
		panel.setBackground(new Color(255, 255, 255));
		panel.setBorder(BorderFactory.createTitledBorder("功能"));
//		panel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, getForeground()));
		contentPane.add(panel, BorderLayout.NORTH);
		
		JButton button = new JButton("收银");
		button.setForeground(new Color(0, 0, 0));
		
		button.setFont(new Font("微软雅黑", Font.PLAIN, 15));
		button.setBackground(new Color(153, 204, 255));
		
		JButton button_1 = new JButton("会员积分兑换");
		
		button_1.setFont(new Font("微软雅黑", Font.PLAIN, 15));
		button_1.setBackground(new Color(153, 204, 255));
		
		JButton btnNewButton = new JButton("会员办理");
		btnNewButton.setFont(new Font("微软雅黑", Font.PLAIN, 15));
		btnNewButton.setBackground(new Color(153, 204, 255));
		
		panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
		panel.add(button);
		panel.add(button_1);
		panel.add(btnNewButton);
		
		JPanel Balance = new JPanel();
		Balance.setBackground(new Color(192, 192, 192));
		contentPane.add(Balance, BorderLayout.CENTER);
		Balance.setLayout(new CardLayout(0, 0));
		
		JPanel balance = new JPanel();
		balance.setBackground(new Color(255, 255, 255));
		Balance.add(balance, "name_100625211986100");
		balance.setLayout(new BorderLayout(0, 0));
		
		JPanel VIP = new JPanel();
		VIP.setBackground(new Color(192, 192, 192));
		balance.add(VIP, BorderLayout.NORTH);
		
		JLabel lblVip = new JLabel("会员手机号：");
		lblVip.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		lblVip.setHorizontalAlignment(SwingConstants.CENTER);
		
		textField = new JTextField();
		textField.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		textField.setColumns(10);
		
		JButton button_2 = new JButton("查询");
		
		button_2.setBackground(new Color(153, 204, 255));
		button_2.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel label = new JLabel("会员姓名：");
		label.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel VIP_name = new JLabel("");
		VIP_name.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel lblNewLabel_1 = new JLabel("累计积分：");
		lblNewLabel_1.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel VIP_integral = new JLabel("");
		VIP_integral.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel lblNewLabel = new JLabel("积分余额：");
		lblNewLabel.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel VIP_balance = new JLabel("");
		VIP_balance.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel lblNewLabel_2 = new JLabel("会员等级：");
		lblNewLabel_2.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel VIP_grade = new JLabel("");
		VIP_grade.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel lblNewLabel_3 = new JLabel("折扣：");
		lblNewLabel_3.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel VIP_discount = new JLabel("");
		VIP_discount.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		GroupLayout gl_VIP = new GroupLayout(VIP);
		gl_VIP.setHorizontalGroup(
			gl_VIP.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_VIP.createSequentialGroup()
					.addContainerGap()
					.addComponent(lblVip, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(textField, GroupLayout.PREFERRED_SIZE, 185, GroupLayout.PREFERRED_SIZE)
					.addGap(18)
					.addComponent(button_2, GroupLayout.PREFERRED_SIZE, 82, GroupLayout.PREFERRED_SIZE)
					.addGap(18)
					.addComponent(label)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(VIP_name, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
					.addGap(18)
					.addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 91, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(VIP_integral, GroupLayout.PREFERRED_SIZE, 96, GroupLayout.PREFERRED_SIZE)
					.addGap(18)
					.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(VIP_balance, GroupLayout.PREFERRED_SIZE, 96, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addComponent(lblNewLabel_2)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(VIP_grade, GroupLayout.PREFERRED_SIZE, 94, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addComponent(lblNewLabel_3, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(VIP_discount, GroupLayout.PREFERRED_SIZE, 92, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(28, Short.MAX_VALUE))
		);
		gl_VIP.setVerticalGroup(
			gl_VIP.createParallelGroup(Alignment.TRAILING)
				.addGroup(gl_VIP.createSequentialGroup()
					.addGroup(gl_VIP.createParallelGroup(Alignment.TRAILING)
						.addGroup(gl_VIP.createSequentialGroup()
							.addContainerGap()
							.addComponent(VIP_balance, GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE))
						.addGroup(Alignment.LEADING, gl_VIP.createSequentialGroup()
							.addContainerGap()
							.addGroup(gl_VIP.createParallelGroup(Alignment.LEADING, false)
								.addComponent(lblNewLabel_1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
								.addComponent(VIP_name, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
								.addGroup(gl_VIP.createParallelGroup(Alignment.BASELINE)
									.addComponent(textField, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE)
									.addComponent(lblVip, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
									.addComponent(button_2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
									.addComponent(label))
								.addComponent(lblNewLabel, GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)))
						.addGroup(Alignment.LEADING, gl_VIP.createSequentialGroup()
							.addGap(14)
							.addComponent(VIP_integral, GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE))
						.addGroup(Alignment.LEADING, gl_VIP.createSequentialGroup()
							.addContainerGap()
							.addGroup(gl_VIP.createParallelGroup(Alignment.LEADING)
								.addComponent(VIP_discount, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
								.addComponent(VIP_grade, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
								.addComponent(lblNewLabel_2, GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
								.addComponent(lblNewLabel_3, GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE))))
					.addContainerGap())
		);
		VIP.setLayout(gl_VIP);
		
		JPanel goodsDetails = new JPanel();
		balance.add(goodsDetails, BorderLayout.CENTER);
		
		JPanel panel_2 = new JPanel();
		panel_2.setBorder(new LineBorder(new Color(100, 149, 237), 2));
		balance.add(panel_2, BorderLayout.SOUTH);
		
		JButton btnNewButton_1 = new JButton("结算");
		
		btnNewButton_1.setBackground(new Color(100, 149, 237));
		btnNewButton_1.setFont(new Font("微软雅黑", Font.PLAIN, 31));
		
		JLabel lblNewLabel_4 = new JLabel("");
		
		JLabel lblNewLabel_5 = new JLabel("商品录入");
		lblNewLabel_5.setFont(new Font("微软雅黑", Font.PLAIN, 26));
		
		textField_1 = new JTextField();
		textField_1.setFont(new Font("微软雅黑", Font.PLAIN, 26));
		textField_1.setColumns(10);
		
		JLabel lblNewLabel_6 = new JLabel("合计金额：");
		lblNewLabel_6.setHorizontalAlignment(SwingConstants.RIGHT);
		lblNewLabel_6.setFont(new Font("微软雅黑", Font.PLAIN, 20));
		
		textField_2 = new JTextField();
		
		textField_2.setHorizontalAlignment(SwingConstants.LEFT);
		textField_2.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		textField_2.setColumns(10);
		
		JLabel label_1 = new JLabel("（元）");
		label_1.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel lblNewLabel_7 = new JLabel("应付金额：");
		lblNewLabel_7.setFont(new Font("微软雅黑", Font.PLAIN, 18));
		
		JLabel lblNewLabel_8 = new JLabel("");
		lblNewLabel_8.setFont(new Font("微软雅黑", Font.PLAIN, 17));
		
		JLabel label_2 = new JLabel("（元）");
		label_2.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		GroupLayout gl_panel_2 = new GroupLayout(panel_2);
		gl_panel_2.setHorizontalGroup(
			gl_panel_2.createParallelGroup(Alignment.TRAILING)
				.addGroup(gl_panel_2.createSequentialGroup()
					.addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_panel_2.createSequentialGroup()
							.addGap(23)
							.addComponent(lblNewLabel_5, GroupLayout.PREFERRED_SIZE, 116, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, 203, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED, 566, Short.MAX_VALUE)
							.addComponent(lblNewLabel_6, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE)
							.addGap(10))
						.addGroup(Alignment.TRAILING, gl_panel_2.createSequentialGroup()
							.addContainerGap()
							.addComponent(lblNewLabel_7)
							.addGap(5)))
					.addGroup(gl_panel_2.createParallelGroup(Alignment.TRAILING, false)
						.addGroup(gl_panel_2.createSequentialGroup()
							.addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
								.addGroup(gl_panel_2.createSequentialGroup()
									.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, 123, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
									.addComponent(label_1)
									.addGap(18))
								.addGroup(gl_panel_2.createSequentialGroup()
									.addGap(2)
									.addComponent(lblNewLabel_8, GroupLayout.PREFERRED_SIZE, 122, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(ComponentPlacement.RELATED, 40, Short.MAX_VALUE)
									.addComponent(label_2)
									.addGap(14)))
							.addComponent(btnNewButton_1, GroupLayout.PREFERRED_SIZE, 176, GroupLayout.PREFERRED_SIZE)
							.addContainerGap())
						.addGroup(gl_panel_2.createSequentialGroup()
							.addComponent(lblNewLabel_4)
							.addGap(413))))
		);
		gl_panel_2.setVerticalGroup(
			gl_panel_2.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_2.createSequentialGroup()
					.addGap(22)
					.addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_panel_2.createSequentialGroup()
							.addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
								.addGroup(gl_panel_2.createSequentialGroup()
									.addGap(24)
									.addGroup(gl_panel_2.createParallelGroup(Alignment.BASELINE)
										.addComponent(lblNewLabel_5)
										.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
								.addComponent(btnNewButton_1, GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)
								.addComponent(lblNewLabel_4))
							.addContainerGap())
						.addGroup(gl_panel_2.createSequentialGroup()
							.addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
								.addGroup(gl_panel_2.createSequentialGroup()
									.addGap(4)
									.addGroup(gl_panel_2.createParallelGroup(Alignment.BASELINE)
										.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE)
										.addComponent(label_1)))
								.addGroup(gl_panel_2.createSequentialGroup()
									.addGap(6)
									.addComponent(lblNewLabel_6, GroupLayout.PREFERRED_SIZE, 32, GroupLayout.PREFERRED_SIZE)))
							.addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
								.addGroup(gl_panel_2.createSequentialGroup()
									.addPreferredGap(ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
									.addComponent(lblNewLabel_7)
									.addGap(20))
								.addGroup(gl_panel_2.createSequentialGroup()
									.addGap(27)
									.addGroup(gl_panel_2.createParallelGroup(Alignment.BASELINE)
										.addComponent(lblNewLabel_8, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
										.addComponent(label_2))
									.addContainerGap())))))
		);
		panel_2.setLayout(gl_panel_2);
		
		JPanel exchange = new JPanel();
		exchange.setBackground(new Color(255, 255, 255));
		Balance.add(exchange, "name_100626710318000");
		exchange.setLayout(new BorderLayout(0, 0));
		
		JPanel panel_1 = new JPanel();
		exchange.add(panel_1, BorderLayout.NORTH);
		panel_1.setLayout(new BorderLayout(0, 0));
		
		JPanel panel_5 = new JPanel();
		panel_1.add(panel_5, BorderLayout.NORTH);
		
		JLabel label_3 = new JLabel("会员账户");
		label_3.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		textField_3 = new JTextField();
		textField_3.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		textField_3.setColumns(10);
		
		JLabel label_4 = new JLabel("会员姓名");
		label_4.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel lblNewLabel_11 = new JLabel("");
		lblNewLabel_11.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel label_5 = new JLabel("积分余额");
		label_5.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel lblNewLabel_12 = new JLabel("");
		lblNewLabel_12.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JButton button_3 = new JButton("查询");
		button_3.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		button_3.setBackground(new Color(135, 206, 235));
		GroupLayout gl_panel_5 = new GroupLayout(panel_5);
		gl_panel_5.setHorizontalGroup(
			gl_panel_5.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_5.createSequentialGroup()
					.addGap(25)
					.addComponent(label_3)
					.addGap(14)
					.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, 171, GroupLayout.PREFERRED_SIZE)
					.addGap(36)
					.addComponent(button_3, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE)
					.addGap(63)
					.addComponent(label_4, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
					.addGap(10)
					.addComponent(lblNewLabel_11, GroupLayout.PREFERRED_SIZE, 123, GroupLayout.PREFERRED_SIZE)
					.addGap(31)
					.addComponent(label_5, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(lblNewLabel_12, GroupLayout.PREFERRED_SIZE, 118, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(514, Short.MAX_VALUE))
		);
		gl_panel_5.setVerticalGroup(
			gl_panel_5.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_5.createSequentialGroup()
					.addGroup(gl_panel_5.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_panel_5.createSequentialGroup()
							.addGap(14)
							.addComponent(label_3))
						.addGroup(gl_panel_5.createSequentialGroup()
							.addContainerGap()
							.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
						.addGroup(gl_panel_5.createSequentialGroup()
							.addGap(10)
							.addComponent(button_3, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE))
						.addGroup(gl_panel_5.createSequentialGroup()
							.addGap(10)
							.addComponent(label_4, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE))
						.addGroup(gl_panel_5.createSequentialGroup()
							.addGap(10)
							.addComponent(lblNewLabel_11, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE))
						.addGroup(gl_panel_5.createSequentialGroup()
							.addGap(7)
							.addComponent(label_5, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE))
						.addGroup(gl_panel_5.createSequentialGroup()
							.addGap(7)
							.addComponent(lblNewLabel_12, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)))
					.addContainerGap(17, Short.MAX_VALUE))
		);
		panel_5.setLayout(gl_panel_5);
		
		JPanel panel_6 = new JPanel();
		panel_1.add(panel_6, BorderLayout.SOUTH);
		
		JLabel lblNewLabel_13 = new JLabel("可兑换商品信息");
		lblNewLabel_13.setFont(new Font("微软雅黑", Font.PLAIN, 30));
		panel_6.add(lblNewLabel_13);
		
		JPanel panel_3 = new JPanel();
		exchange.add(panel_3, BorderLayout.SOUTH);
		
		JLabel lblNewLabel_9 = new JLabel("总计积分：");
		lblNewLabel_9.setFont(new Font("微软雅黑", Font.PLAIN, 18));
		
		JLabel lblNewLabel_10 = new JLabel("");
		lblNewLabel_10.setFont(new Font("微软雅黑", Font.PLAIN, 18));
		
		JLabel lblNewLabel_14 = new JLabel("兑换后余额积分：");
		lblNewLabel_14.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JLabel lblNewLabel_15 = new JLabel("");
		lblNewLabel_15.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		JButton btnNewButton_2 = new JButton("确认兑换");
		
		btnNewButton_2.setBackground(new Color(135, 206, 235));
		btnNewButton_2.setFont(new Font("微软雅黑", Font.PLAIN, 18));
		GroupLayout gl_panel_3 = new GroupLayout(panel_3);
		gl_panel_3.setHorizontalGroup(
			gl_panel_3.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_3.createSequentialGroup()
					.addGap(495)
					.addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
						.addComponent(lblNewLabel_9, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblNewLabel_14, Alignment.TRAILING))
					.addGap(26)
					.addGroup(gl_panel_3.createParallelGroup(Alignment.TRAILING)
						.addComponent(lblNewLabel_10, GroupLayout.PREFERRED_SIZE, 96, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblNewLabel_15, GroupLayout.PREFERRED_SIZE, 91, GroupLayout.PREFERRED_SIZE))
					.addGap(59)
					.addComponent(btnNewButton_2)
					.addContainerGap(535, Short.MAX_VALUE))
		);
		gl_panel_3.setVerticalGroup(
			gl_panel_3.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_3.createSequentialGroup()
					.addContainerGap()
					.addComponent(lblNewLabel_9, GroupLayout.PREFERRED_SIZE, 39, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(49, Short.MAX_VALUE))
				.addGroup(gl_panel_3.createSequentialGroup()
					.addGap(17)
					.addComponent(lblNewLabel_10, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
					.addGroup(gl_panel_3.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblNewLabel_14)
						.addComponent(lblNewLabel_15, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE))
					.addGap(15))
				.addGroup(Alignment.TRAILING, gl_panel_3.createSequentialGroup()
					.addContainerGap(21, Short.MAX_VALUE)
					.addComponent(btnNewButton_2, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
					.addContainerGap())
		);
		panel_3.setLayout(gl_panel_3);
		
		JPanel panel_4 = new JPanel();
		exchange.add(panel_4, BorderLayout.CENTER);
		panel_4.setLayout(new BorderLayout(0, 0));
		
		JScrollPane scrollPane = new JScrollPane();
		panel_4.add(scrollPane, BorderLayout.CENTER);
		
		table = new JTable(){
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			public boolean isCellEditable(int row, int column)
			{
				return false;
			}
		};
		
		table.setModel(new DefaultTableModel(
			new Object[][] {
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
				{null, null, null, null, null},
			},
			new String[] {
				"\u5546\u54C1\u7F16\u53F7", "\u5546\u54C1\u540D\u79F0", "\u79EF\u5206", "\u6570\u91CF", "\u662F\u5426\u9009\u4E2D"
			}
		));
		JTableHeader head = table.getTableHeader();
		//设置表头的大小
		head.setPreferredSize(new Dimension(head.getWidth(),30));
		//设置表头字体大小
		head.setFont(new Font("宋体",Font.BOLD,16));
		//设置表格的行宽
		table.setRowHeight(30);
		//设置表格行中字体大小
		table.setFont(new Font("微软雅黑", Font.PLAIN, 14));
		/*设置表格中的内容居中*/
		DefaultTableCellRenderer renderer=new DefaultTableCellRenderer();
		renderer.setHorizontalAlignment(DefaultTableCellRenderer.CENTER);
		table.setDefaultRenderer(Object.class, renderer);
		JCheckBox box = new JCheckBox();
		table.getColumnModel().getColumn(4).setCellRenderer(new TableCellRenderer() {
			
			@Override
			public Component getTableCellRendererComponent(JTable table, Object value,
					boolean isSelected, boolean hasFocus,int row, int column) {
				
				
				/*设置当复选框被选中整行被渲染*/
				box.setSelected(isSelected);
				
				/*设置复选框在单元格中居中*/
				box.setHorizontalAlignment((int) 0.5f);
				
				return box;
			}
			
		});

		scrollPane.setViewportView(table);
		
		JPanel deal = new JPanel();
		deal.setBackground(new Color(255, 255, 255));
		Balance.add(deal, "name_100628063528900");
		deal.setLayout(new BorderLayout(0, 0));
		
		JPanel panel_7 = new JPanel();
		deal.add(panel_7, BorderLayout.CENTER);
		
		JPanel panel_8 = new JPanel();
		GroupLayout gl_panel_7 = new GroupLayout(panel_7);
		gl_panel_7.setHorizontalGroup(
			gl_panel_7.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_7.createSequentialGroup()
					.addGap(250)
					.addComponent(panel_8, GroupLayout.PREFERRED_SIZE, 1155, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(39, Short.MAX_VALUE))
		);
		gl_panel_7.setVerticalGroup(
			gl_panel_7.createParallelGroup(Alignment.TRAILING)
				.addGroup(Alignment.LEADING, gl_panel_7.createSequentialGroup()
					.addGap(48)
					.addComponent(panel_8, GroupLayout.PREFERRED_SIZE, 596, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(50, Short.MAX_VALUE))
		);
		
		JLabel lblNewLabel_16 = new JLabel("姓名：");
		lblNewLabel_16.setHorizontalAlignment(SwingConstants.RIGHT);
		lblNewLabel_16.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		textField_4 = new JTextField();
		textField_4.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		textField_4.setColumns(10);
		
		JLabel lblNewLabel_17 = new JLabel("手机号：");
		lblNewLabel_17.setHorizontalAlignment(SwingConstants.CENTER);
		lblNewLabel_17.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		
		textField_5 = new JTextField();
		textField_5.setFont(new Font("微软雅黑", Font.PLAIN, 16));
		textField_5.setColumns(10);
		
		JButton btnNewButton_3 = new JButton("注册");
		btnNewButton_3.setBackground(new Color(135, 206, 250));
		btnNewButton_3.setForeground(new Color(0, 0, 0));
		btnNewButton_3.setFont(new Font("微软雅黑", Font.PLAIN, 18));
		btnNewButton_3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		
		JLabel lblNewLabel_18 = new JLabel("填写会员信息");
		lblNewLabel_18.setHorizontalAlignment(SwingConstants.CENTER);
		lblNewLabel_18.setFont(new Font("微软雅黑", Font.PLAIN, 25));
		GroupLayout gl_panel_8 = new GroupLayout(panel_8);
		gl_panel_8.setHorizontalGroup(
			gl_panel_8.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_8.createSequentialGroup()
					.addGap(427)
					.addComponent(lblNewLabel_18, GroupLayout.PREFERRED_SIZE, 198, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(530, Short.MAX_VALUE))
				.addGroup(gl_panel_8.createSequentialGroup()
					.addGroup(gl_panel_8.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_panel_8.createSequentialGroup()
							.addGap(361)
							.addComponent(lblNewLabel_17))
						.addGroup(Alignment.TRAILING, gl_panel_8.createSequentialGroup()
							.addContainerGap(367, Short.MAX_VALUE)
							.addComponent(lblNewLabel_16, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED)))
					.addGap(83)
					.addGroup(gl_panel_8.createParallelGroup(Alignment.LEADING, false)
						.addComponent(textField_5)
						.addComponent(textField_4, GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE))
					.addGap(450))
				.addGroup(gl_panel_8.createSequentialGroup()
					.addGap(461)
					.addComponent(btnNewButton_3, GroupLayout.PREFERRED_SIZE, 167, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(527, Short.MAX_VALUE))
		);
		gl_panel_8.setVerticalGroup(
			gl_panel_8.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_8.createSequentialGroup()
					.addGroup(gl_panel_8.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_panel_8.createSequentialGroup()
							.addGap(39)
							.addComponent(lblNewLabel_18, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE)
							.addGap(113))
						.addGroup(gl_panel_8.createSequentialGroup()
							.addContainerGap(124, Short.MAX_VALUE)
							.addGroup(gl_panel_8.createParallelGroup(Alignment.BASELINE)
								.addComponent(textField_4, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
								.addComponent(lblNewLabel_16, GroupLayout.PREFERRED_SIZE, 34, GroupLayout.PREFERRED_SIZE))
							.addGap(41)))
					.addGap(4)
					.addGroup(gl_panel_8.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblNewLabel_17)
						.addComponent(textField_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(124)
					.addComponent(btnNewButton_3, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
					.addGap(196))
		);
		panel_8.setLayout(gl_panel_8);
		panel_7.setLayout(gl_panel_7);
		
		JPanel black = new JPanel();
		Balance.add(black, "name_110318226314800");
		balance.setVisible(false);
		exchange.setVisible(false);
		deal.setVisible(false);
		black.show(true);
		
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				exchange.setVisible(false);
				deal.setVisible(false);
				black.setVisible(false);
				balance.show();
			}
		});
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				deal.setVisible(false);
				black.setVisible(false);
				balance.setVisible(false);
				exchange.show(true);
				
				ItemGoods ig = new ItemGoods();
				ArrayList<ItemGoods> list =ig.selectItem();
				int i =0;
				for(ItemGoods j:list)
				{
					table.setValueAt(j.getI_no(), i, 0);
					table.setValueAt(j.getItem(), i, 1);
					table.setValueAt(j.getI_points(), i, 2);
					table.setValueAt(j.getNumber(), i, 3);
					i++;
				}
			
						
					
			}
		});
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				
				black.setVisible(false);
				balance.setVisible(false);
				exchange.setVisible(false);
				deal.show(true);
				
			}
		});
		button_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				String st = textField.getText();
				vipInformation vip = new vipInformation(st);
				vip.inquiryUser();
				VIP_name.setText(vip.getName());
				VIP_integral.setText(String.valueOf(vip.getA_point()));
				VIP_balance.setText(String.valueOf(vip.getPoint()));
				VIP_grade.setText(vip.getVIPname());
				DiscountGlobal.setDiscount(vip.getVIP_discount());
				String s = ""+vip.getVIP_discount();
//				System.out.println(vip.getVIP_discount());
				VIP_discount.setText(s);
			}
		});
		textField_2.addCaretListener(new CaretListener() {
			public void caretUpdate(CaretEvent arg0) {
				String st = VIP_name.getText();
//				System.out.println(VIP_name.getText());
				if(VIP_name.getText() == null)
				{
					VIP_name.setText("");
					st = VIP_name.getText();
				}
				if(st.equals(""))
				{
//					System.out.println("dfserwed");
					lblNewLabel_8.setText(textField_2.getText());
				}
				else
				{
					float i =0;
					
					
//					System.out.println("dfsd");
					if(textField_2.getText().equals(""))
					{
						i = 0;
					}
					else
					{
						i = Integer.parseInt(textField_2.getText());
					}
					lblNewLabel_8.setText(String.valueOf((i*DiscountGlobal.getDiscount()*100)/100));
				}
			}
		});
		btnNewButton_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				int point = 0;
				if(lblNewLabel_8.getText().equals(""))
				{
					point = 0;
				}
				else
				{
					point = Double.valueOf(lblNewLabel_8.getText()).intValue();
				}
				
//				System.out.println(point);
				String st = VIP_name.getText();
				if(VIP_name.getText() == null)
				{
					VIP_name.setText("");
					st = VIP_name.getText();
				}
				if(!VIP_name.getText().equals(""))
				{
//					System.out.println(VIP_name.getText());
					String str = textField.getText();
					vipInformation vip = new vipInformation(str);
					vip.inquiryUser();
					int i = 1;
					if(vip.getA_point()+point <= 500)
					{
						i = 1;
					}else if(vip.getA_point()+point <= 1500)
					{
						i = 2;
					}else
					{
						i = 3;
					}
					
					if(vip.updata_1_User(vip.getPoint()+point, i, vip.getA_point()+ point, str))
					{
						System.out.println("updata");
					}
				}
				else
				{
					System.out.println("普通用户");
				}
			}
		});
		button_3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				String st = textField_3.getText();
//				System.out.println(VIP_name.getText());
				if(textField_3.getText() == null)
				{
					textField_3.setText("");
					st = textField_3.getText();
				}
				vipInformation vip = new vipInformation(st);
				vip.inquiryUser();
				lblNewLabel_11.setText(vip.getName());
				lblNewLabel_12.setText(String.valueOf(vip.getPoint()));
				DiscountGlobal.setPoint(vip.getPoint());
				
			}
		});
		
		table.getSelectionModel().addListSelectionListener(new ListSelectionListener(
				) {
			
			@Override
			public void valueChanged(ListSelectionEvent e) {
				// TODO Auto-generated method stub
				
				int[] x = table.getSelectedRows();
				int sum = 0;
				for(int i = 0; i < x.length; i++)
				{
					if(table.getValueAt(x[i], 2) == null)
					{
						continue;
					}
					System.out.println();
					sum += Integer.parseInt(String.valueOf(table.getValueAt(x[i], 2)) );
				}
				lblNewLabel_10.setText(String.valueOf(sum));
				lblNewLabel_15.setText(String.valueOf(DiscountGlobal.getPoint() - sum));
			}
		});
		btnNewButton_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				int st =Integer.parseInt(lblNewLabel_15.getText());
				if(st < 0)
				{
					System.out.println("余额不足");
				}
				else
				{
					vipInformation vip = new vipInformation(textField_3.getText());
					vip.updata_User_point(st, textField_3.getText());
					vip.inquiryUser();
					lblNewLabel_12.setText(String.valueOf(vip.getPoint()));
					
				}
				
			}
		});
			
	}
	
}
